Developer --> Technical Publications
PATHMac OS 8 Developer Documentation > Files > Navigation Services >

Programming With Navigation Services 1.1


Customizing Type Pop-up Menus

The Show pop-up menu displayed in Open dialog boxes and the Format pop-up menu displayed in Save dialog boxed are known collectively as type pop-up menus . If your application needs to add its own menu items to one of the type pop-up menus, use a structure of type NavMenuItemSpec to describe each menu item to add. This allows you to add specific document types to be opened or saved, or different ways of saving a file (with or without line breaks, as HTML, and so forth). To set your menu items, add a handle to one or more NavMenuItemSpec structures to the popupExtension field in the structure of type NavDialogOptions that you pass in the dialogOptions parameter of the appropriate function. If you provide a NavMenuItemSpec structure, you must also provide an event-handling function and an object filtering function. Navigation Services will not handle your custom menu items, so if you do not provide these application-defined functions and attempt to use a NavMenuItemSpec structure, Navigation Services functions return a result of paramErr (-50). For more information, see Creating Application-Defined Functions.

You do not have to provide a value in the menuItemName field of the NavMenuItemSpec structure, but Navigation Services uses this value, if it is available, as a search key. If you choose not to provide a value for this field, make sure to set it to an empty string.

To handle and examine a selected pop-up menu item, respond to the kNavCBPopupMenuSelect message constant, described in Custom Control Setting Constants , when Navigation Services calls your application's event-handling function. Navigation Services provides information about the selected menu item in a structure of type NavCBRec passed in the callBackParms parameter of your event-handling function. The param field of the NavCBRec structure points to a structure of type NavMenuItemSpec describing the menu item. Your application can respond to a particular menu item by comparing the type and creator fields, for example.

It is possible to set the Show or Format pop-up menus so that they display only custom items.

If your application tries to extend the type pop-up menu and does not provide an event-handling function, Navigation Services functions return a result of paramErr (-50). If you add menu items that require filtering, you must implement a filter function. For more information, see Filtering File Objects.


© 1998 Apple Computer, Inc. – (Last Updated 23 Nov 98)

Previous | Back Up One Level | Next |